package com.dms.wuziqi.mapper;

import com.dms.wuziqi.pojo.Manager;
import com.dms.wuziqi.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ManagerMapper {
    @Select("SELECT * FROM manager_info where manager_name=#{ManagerName} and managerPwd=#{ManagerPwd}")
    @Results({
            @Result(column = "manager_name",property = "ManagerName"),
            @Result(column = "managerPwd",property = "ManagerPwd"),
    })
    Manager findManager(String ManagerName,String ManagerPwd);
    @Select("select * from userInfo")
    @Results({
            @Result(column = "user_id",property = "userId"),
            @Result(column = "user_id",property = "loans",many = @Many(select = "com.dms.wuziqi.mapper.LoanMapper.getAllLoanByUserId")),
            @Result(column = "user_realname",property = "userRealName"),
            @Result(column = "risk_level",property = "riskLevel"),
            @Result(column = "user_cardId",property = "userCardId"),
            @Result(column = "user_phone",property = "userPhone")
    })
    List<User> findAllUser();
}
